//
//  ViewController.m
//  runtime字典转模型
//
//  Created by 李松 on 2017/11/23.
//  Copyright © 2017年 李松. All rights reserved.
//

#import "ViewController.h"
#import "UserItem.h"
#import "NSObject+Model.h"
#import "FriendItem.h"

@interface ViewController ()

/*数据*/
@property (nonatomic,strong) NSMutableArray <UserItem *> *dateArray;

@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view, typically from a nib.
    NSString *path = [[NSBundle mainBundle] pathForResource:@"dataList.plist" ofType:nil];
    NSArray *dataArray = [[NSArray alloc] initWithContentsOfFile:path];
    //NSLog(@"%@", dataArray);
    for (NSDictionary *dic in dataArray) {
        UserItem *user = [UserItem modelWithDic:dic];
        NSLog(@"%@", user.friends.name);
        [self.dateArray addObject:user];
    }
    NSLog(@"%@", self.dateArray);
}

- (NSMutableArray<UserItem *> *)dateArray{
    if (_dateArray == nil) {
        _dateArray = [NSMutableArray array];
    }
    return _dateArray;
}


- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}


@end
